'use strict';


const unipay = require('uni-pay');

const unipayIns = unipay.initWeixin({

  appId: 'wxab056e746467b13f',//利用在对应领取平台的appId

  mchId: '1616845953',//商户号

  key: 'QWERTYUOPASDFGHJKLZXCVBNM1234567',//领取秘钥

})

exports.main = async function (event,context) { //event是客户端传过来的参数
	console.log('OK')
	console.log(event)
    let orderInfo = await unipayIns.getOrderInfo({ 
        body: '微信支付',

        outTradeNo: event.order_number,

        totalFee: event.money * 100, // 金额，单位分

        tradeType:'JSAPI',
		
		openid: event.openid,
		
        notifyUrl: 'https://www.apricity.asia:8911' // 领取后果告诉地址

    })

    return {
        orderInfo
    }
}
